#include<iostream>
using namespace std;

int main () {
int n, l, r, mx = -1;
cin >> n >> l >> r;
if(l/n == r/n)
    cout << r << endl;
else
    cout << l/n*n + n - 1 << endl;
    return 0;
}